home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / library / p61lib.lha / P61Lib / Src / p61.s < prev    next >
Text File  |  1995-08-25  |  39KB  |  2,459 lines

  1.  
  2. * The Player 6.1A for DevPac 3, for subsequent conversion to an E module *
  3.  
  4. ;start = 6    ;Starting position
  5.  
  6. fade  = 1    ;0 = Normal, NO master volume control possible
  7.         ;1 = Use master volume (P61_Master)
  8.  
  9. jump = 1    ;0 = do NOT include position jump code (P61_SetPosition)
  10.         ;1 = Include
  11. system = 1    ;0 = killer
  12.         ;1 = friendly
  13.  
  14. CIA = 1        ;0 = CIA disabled
  15.         ;1 = CIA enabled
  16.  
  17. exec = 1    ;0 = ExecBase destroyed
  18.         ;1 = ExecBase valid
  19.  
  20. lev6 = 1    ;0 = NonLev6
  21.         ;1 = Lev6 used
  22.  
  23. opt020 = 0    ;0 = MC680x0 code
  24.         ;1 = MC68020+ or better
  25.  
  26. channels = 4    ;amount of channels to be played
  27.  
  28. use = -1    ;The Usecode
  29.  
  30.     include misc/Player61.i
  31.  
  32.     xdef    P61_Base
  33.  
  34. P61_Base    lea    P61_Master,a0
  35.         move.l    a0,d0
  36.         rts
  37.  
  38. P61_Master    dc    64        ;Master volume (0-64)
  39. P61_Tempo    dc    1        ;Use tempo? 0=no,non-zero=yes
  40. P61_Play    dc    1        ;Stop flag (0=stop)
  41. P61_E8        dc    0        ;Info nybble after command E8
  42. P61_VBR        dc.l    0        ;If you're using non-valid execbase
  43.                     ;put VBR here! (Otherwise 0 assumed)
  44.                     ;You can also get VBR from here, if
  45.                     ;using exec-valid version
  46.  
  47. P61_Pos        dc    0        ;Current song position
  48. P61_Patt    dc    0        ;Current pattern
  49. P61_CRow    dc    0        ;Current pattern row
  50.  
  51. P61_Playing    dc    -1
  52.  
  53. P61_getnote    macro
  54.     moveq    #$7e,d0
  55.     and.b    (a5),d0
  56.     beq.b    .nonote
  57.     ifne    P61_vib
  58.     clr.b    P61_VibPos(a5)
  59.     endc
  60.     ifne    P61_tre
  61.     clr.b    P61_TrePos(a5)
  62.     endc
  63.  
  64.     ifne    P61_ft
  65.     add    P61_Fine(a5),d0
  66.     endc
  67.     move    d0,P61_Note(a5)
  68.     move    (a2,d0),P61_Period(a5)
  69.  
  70. .nonote
  71.     endm
  72.  
  73.     ifeq    system
  74.     ifne    CIA
  75. P61_intti
  76.     movem.l    d0-a6,-(sp)
  77.     tst.b    $bfdd00
  78.     lea    $dff000,a6
  79.     move    #$2000,$9c(a6)
  80.     move    #$fff,$180(a6)
  81.     bsr    P61_Music
  82.     move    #0,$180(a6)
  83.     movem.l    (sp)+,d0-a6
  84.     nop
  85.     rte
  86.     endc
  87.     endc
  88.  
  89.     ifne    system
  90. P61_lev6server
  91.     movem.l    d2-d7/a2-a6,-(sp)
  92.     lea    $dff000,a6
  93.  
  94.     move    P61_server(pc),d0
  95.     beq.b    P61_musica
  96.     subq    #1,d0
  97.     beq    P61_dmason
  98.     bra    P61_setrepeat
  99.  
  100. P61_musica
  101.     bsr    P61_Music
  102.  
  103. P61_ohi    movem.l    (sp)+,d2-d7/a2-a6
  104.     moveq    #1,d0
  105.     rts
  106.     endc
  107.  
  108. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  109. ;­ Call P61_Init to initialize the playroutine    ­
  110. ;­ D0 --> Timer detection (for CIA-version)    ­
  111. ;­ A0 --> Address to the module            ­
  112. ;­ A1 --> Address to samples/0            ­
  113. ;­ A2 --> Address to sample buffer        ­
  114. ;­ D0 <-- 0 if succeeded            ­
  115. ;­ A6 <-- $DFF000                ­
  116. ;­         Uses D0-A6            ­
  117. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  118.  
  119.     xdef    P61_Init__iii
  120.  
  121. P61_Init__iii    movem.l    d1-a6,-(sp)
  122.         moveq    #-1,d0
  123.         tst.w    P61_Playing
  124.         beq    .urk
  125.         move.l    60(sp),a2
  126.         move.l    64(sp),a1
  127.         move.l    68(sp),a0
  128.         moveq    #0,d0
  129.         bsr    _P61_Init
  130.         move.w    d0,P61_Playing
  131. .urk        movem.l    (sp)+,d1-a6
  132.         rts
  133.  
  134. _P61_Init
  135.     cmp.l    #"P61A",(a0)+
  136.     beq.b    .modok
  137.     subq.l    #4,a0
  138.  
  139. .modok
  140.     ifne    CIA
  141.     move    d0,-(sp)
  142.     endc
  143.  
  144.     moveq    #0,d0
  145.     cmp.l    d0,a1
  146.     bne.b    .redirect
  147.  
  148.     move    (a0),d0
  149.     lea    (a0,d0.l),a1
  150. .redirect
  151.     move.l    a2,a6
  152.     lea    8(a0),a2
  153.     moveq    #$40,d0
  154.     and.b    3(a0),d0
  155.     bne.b    .buffer
  156.     move.l    a1,a6
  157.     subq.l    #4,a2
  158. .buffer
  159.  
  160.     lea    P61_cn(pc),a3
  161.     moveq    #$1f,d1
  162.     and.b    3(a0),d1
  163.     move.l    a0,-(sp)
  164.     lea    P61_Samples(pc),a4
  165.     subq    #1,d1
  166.     moveq    #0,d4
  167. P61_lopos
  168.     move.l    a6,(a4)+
  169.     move    (a2)+,d4
  170.     bpl.b    P61_kook
  171.     neg    d4
  172.     lea    P61_Samples-16(pc),a5
  173.     ifeq    opt020
  174.     asl    #4,d4
  175.     move.l    (a5,d4),d6
  176.     else
  177.     add    d4,d4
  178.     move.l    (a5,d4*8),d6
  179.     endc
  180.     move.l    d6,-4(a4)
  181.     move    4(a5,d4),d4
  182.     sub.l    d4,a6
  183.     sub.l    d4,a6
  184.     bra.b    P61_jatk
  185.  
  186. P61_kook
  187.     move.l    a6,d6
  188.     tst.b    3(a0)
  189.     bpl.b    P61_jatk
  190.  
  191.     tst.b    (a2)
  192.     bmi.b    P61_jatk
  193.  
  194.     move    d4,d0
  195.     subq    #2,d0
  196.     bmi.b    P61_jatk
  197.  
  198.     move.l    a1,a5
  199.     move.b    (a5)+,d2
  200.     sub.b    (a5),d2
  201.     move.b    d2,(a5)+
  202. .loop    sub.b    (a5),d2
  203.     move.b    d2,(a5)+
  204.     sub.b    (a5),d2
  205.     move.b    d2,(a5)+
  206.     dbf    d0,.loop
  207.  
  208. P61_jatk
  209.     move    d4,(a4)+
  210.     moveq    #0,d2
  211.     move.b    (a2)+,d2
  212.     moveq    #0,d3
  213.     move.b    (a2)+,d3
  214.  
  215.     moveq    #0,d0
  216.     move    (a2)+,d0
  217.     bmi.b    .norepeat
  218.  
  219.     move    d4,d5
  220.     sub    d0,d5
  221.     move.l    d6,a5
  222.  
  223.     add.l    d0,a5
  224.     add.l    d0,a5
  225.  
  226.     move.l    a5,(a4)+
  227.     move    d5,(a4)+
  228.     bra.b    P61_gene
  229. .norepeat
  230.     move.l    d6,(a4)+
  231.     move    #1,(a4)+
  232. P61_gene
  233.     move    d3,(a4)+
  234.     moveq    #$f,d0
  235.     and    d2,d0
  236.     mulu    #74,d0
  237.     move    d0,(a4)+
  238.  
  239.     tst    -6(a2)
  240.     bmi.b    .nobuffer
  241.  
  242.     moveq    #$40,d0
  243.     and.b    3(a0),d0
  244.     beq.b    .nobuffer
  245.  
  246.     move    d4,d7
  247.     tst.b    d2
  248.     bpl.b    .copy
  249.  
  250.     subq    #1,d7
  251.     moveq    #0,d5
  252.     moveq    #0,d4
  253. .lo    move.b    (a1)+,d4
  254.     moveq    #$f,d3
  255.     and    d4,d3
  256.     lsr    #4,d4
  257.  
  258.     sub.b    .table(pc,d4),d5
  259.     move.b    d5,(a6)+
  260.     sub.b    .table(pc,d3),d5
  261.     move.b    d5,(a6)+
  262.     dbf    d7,.lo
  263.     bra.b    .kop
  264.  
  265. .copy    add    d7,d7
  266.     subq    #1,d7
  267. .cob    move.b    (a1)+,(a6)+
  268.     dbf    d7,.cob
  269.     bra.b    .kop
  270.  
  271. .table dc.b    0,1,2,4,8,16,32,64,128,-64,-32,-16,-8,-4,-2,-1
  272.  
  273. .nobuffer
  274.     move.l    d4,d6
  275.     add.l    d6,d6
  276.     add.l    d6,a6
  277.     add.l    d6,a1
  278. .kop    dbf    d1,P61_lopos
  279.  
  280.     move.l    (sp)+,a0
  281.     and.b    #$7f,3(a0)
  282.  
  283.     move.l    a2,-(sp)
  284.  
  285.     lea    P61_temp0(pc),a1
  286.     lea    P61_temp1(pc),a2
  287.     lea    P61_temp2(pc),a4
  288.     lea    P61_temp3(pc),a5
  289.     moveq    #Channel_Block_SIZE/2-2,d0
  290.  
  291.     moveq    #0,d1
  292. .cl    move    d1,(a1)+
  293.     move    d1,(a2)+
  294.     move    d1,(a4)+
  295.     move    d1,(a5)+
  296.     dbf    d0,.cl
  297.  
  298.     move.l    (sp)+,a2
  299.     move.l    a2,P61_positionbase-P61_cn(a3)
  300.  
  301.     moveq    #$7f,d1
  302.     and.b    2(a0),d1
  303.  
  304.     ifeq    opt020
  305.     lsl    #3,d1
  306.     lea    (a2,d1.l),a4
  307.     else
  308.     lea    (a2,d1.l*8),a4
  309.     endc
  310.     move.l    a4,P61_possibase-P61_cn(a3)
  311.  
  312.     move.l    a4,a1
  313.     moveq    #-1,d0
  314. .search    cmp.b    (a1)+,d0
  315.     bne.b    .search
  316.     move.l    a1,P61_patternbase-P61_cn(a3)    
  317.     move.l    a1,d0
  318.     sub.l    a4,d0
  319.     move    d0,P61_slen-P61_cn(a3)
  320.  
  321.     ifd    start
  322.     lea    start(a4),a4
  323.     endc
  324.  
  325.     moveq    #0,d0
  326.     move.b    (a4)+,d0
  327.     move.l    a4,P61_spos-P61_cn(a3)
  328.     lsl    #3,d0
  329.     add.l    d0,a2
  330.  
  331.     move.l    a1,a4
  332.     moveq    #0,d0    
  333.     move    (a2)+,d0
  334.     lea    (a4,d0.l),a1
  335.     move.l    a1,P61_ChaPos+P61_temp0-P61_cn(a3)
  336.     move    (a2)+,d0
  337.     lea    (a4,d0.l),a1
  338.     move.l    a1,P61_ChaPos+P61_temp1-P61_cn(a3)
  339.     move    (a2)+,d0
  340.     lea    (a4,d0.l),a1
  341.     move.l    a1,P61_ChaPos+P61_temp2-P61_cn(a3)
  342.     move    (a2)+,d0
  343.     lea    (a4,d0.l),a1
  344.     move.l    a1,P61_ChaPos+P61_temp3-P61_cn(a3)
  345.  
  346.     lea    P61_setrepeat(pc),a0
  347.     move.l    a0,P61_intaddr-P61_cn(a3)
  348.  
  349.     move    #63,P61_rowpos-P61_cn(a3)
  350.     move    #6,P61_speed-P61_cn(a3)
  351.     move    #5,P61_speed2-P61_cn(a3)
  352.     clr    P61_speedis1-P61_cn(a3)
  353.  
  354.     ifne    P61_pl
  355.     clr.l    P61_plcount-P61_cn(a3)
  356.     endc
  357.  
  358.     ifne    P61_pde
  359.     clr    P61_pdelay-P61_cn(a3)
  360.     clr    P61_pdflag-P61_cn(a3)
  361.     endc
  362.     clr    (a3)
  363.  
  364.     moveq    #2,d0
  365.     and.b    $bfe001,d0
  366.     move.b    d0,P61_ofilter-P61_cn(a3)
  367.     bset    #1,$bfe001
  368.  
  369.     ifeq    system
  370.     ifne    exec
  371.     move.l    4.w,a6
  372.     moveq    #0,d0
  373.     btst    d0,297(a6)
  374.     beq.b    .no68010
  375.  
  376.     lea    P61_liko(pc),a5
  377.     jsr    -$1e(a6)
  378.  
  379. .no68010
  380.     move.l    d0,P61_VBR-P61_cn(a3)
  381.     endc
  382.  
  383.     move.l    P61_VBR-P61_cn(a3),a0
  384.     lea    $78(a0),a0
  385.     move.l    a0,P61_vektori-P61_cn(a3)
  386.  
  387.     move.l    (a0),P61_oldlev6-P61_cn(a3)
  388.     lea    P61_dmason(pc),a1
  389.     move.l    a1,(a0)
  390.     endc
  391.  
  392.     moveq    #0,d0
  393.     lea    $dff000,a6
  394.     move    d0,$a8(a6)
  395.     move    d0,$b8(a6)
  396.     move    d0,$c8(a6)
  397.     move    d0,$d8(a6)
  398.     move    #$f,$96(a6)
  399.  
  400.     ifeq    system
  401.     lea    P61_dmason(pc),a1
  402.     move.l    a1,(a0)
  403.     move    #$2000,$9a(a6)
  404.     lea    $bfd000,a0
  405.     lea    P61_Timers(pc),a1
  406.     move.b    #$7f,$d00(a0)
  407.     move.b    #$10,$e00(a0)
  408.     move.b    #$10,$f00(a0)
  409.     move.b    $400(a0),(a1)+
  410.     move.b    $500(a0),(a1)+
  411.     move.b    $600(a0),(a1)+
  412.     move.b    $700(a0),(a1)
  413.     endc
  414.  
  415.     ifeq    system!CIA
  416.     move.b    #$82,$d00(a0)
  417.     endc
  418.  
  419.     ifne    CIA
  420.     move    (sp)+,d0
  421.     subq    #1,d0
  422.     beq.b    P61_ForcePAL
  423.     subq    #1,d0
  424.     beq.b    P61_NTSC
  425.     ifne    exec
  426.     move.l    4.w,a1
  427.     cmp.b    #60,$213(a1)    ;PowerSupplyFrequency
  428.     beq.b    P61_NTSC
  429.     endc
  430. P61_ForcePAL
  431.     move.l    #1773447,d0    ;PAL
  432.     bra.b    P61_setcia
  433. P61_NTSC
  434.     move.l    #1789773,d0    ;NTSC
  435. P61_setcia
  436.     move.l    d0,P61_timer-P61_cn(a3)
  437.     divu    #125,d0
  438.     move    d0,P61_thi2-P61_cn(a3)
  439.     sub    #$1f0*2,d0
  440.     move    d0,P61_thi-P61_cn(a3)
  441.  
  442.     ifeq    system
  443.     move    P61_thi2-P61_cn(a3),d0
  444.     move.b    d0,$400(a0)
  445.     lsr    #8,d0
  446.     move.b    d0,$500(a0)
  447.     lea    P61_intti(pc),a1
  448.     move.l    a1,P61_tintti-P61_cn(a3)
  449.     move.l    P61_vektori(pc),a2
  450.     move.l    a1,(a2)
  451.     move.b    #$83,$d00(a0)
  452.     move.b    #$11,$e00(a0)
  453.     endc
  454.     endc
  455.  
  456.     ifeq    system
  457.     move    #$e000,$9a(a6)
  458.     moveq    #0,d0
  459.     rts
  460.  
  461.     ifne    exec
  462. P61_liko
  463.     dc.l    $4E7A0801        ;MOVEC    VBR,d0
  464.     rte
  465.     endc
  466.     endc
  467.  
  468.     ifne    system
  469.     move.l    a6,-(sp)
  470.  
  471.     ifne    CIA
  472.     clr    P61_server-P61_cn(a3)
  473.     else
  474.     move    #1,P61_server-P61_cn(a3)
  475.     endc
  476.  
  477.     move.l    4.w,a6
  478.     moveq    #-1,d0
  479.     jsr    -$14a(a6)
  480.     move.b    d0,P61_sigbit-P61_cn(a3)
  481.     bmi    P61_err
  482.  
  483.     lea    P61_allocport(pc),a1
  484.     move.l    a1,P61_portti-P61_cn(a3)
  485.     move.b    d0,15(a1)
  486.     move.l    a1,-(sp)
  487.     suba.l    a1,a1
  488.     jsr    -$126(a6)
  489.     move.l    (sp)+,a1
  490.     move.l    d0,16(a1)
  491.     lea    P61_reqlist(pc),a0
  492.     move.l    a0,(a0)
  493.     addq.l    #4,(a0)
  494.     clr.l    4(a0)
  495.     move.l    a0,8(a0)
  496.  
  497.     lea    P61_dat(pc),a1
  498.     move.l    a1,P61_reqdata-P61_cn(a3)
  499.     lea    P61_allocreq(pc),a1
  500.     lea    P61_audiodev(pc),a0
  501.     moveq    #0,d0
  502.     moveq    #0,d1
  503.     jsr    -$1bc(a6)
  504.     tst.b    d0
  505.     bne    P61_err
  506.     st.b    P61_audioopen-P61_cn(a3)
  507.  
  508.     lea    P61_timerint(pc),a1
  509.     move.l    a1,P61_timerdata-P61_cn(a3)
  510.     lea    P61_lev6server(pc),a1
  511.     move.l    a1,P61_timerdata+8-P61_cn(a3)
  512.  
  513.     moveq    #0,d3
  514.     lea    P61_cianame(pc),a1
  515. P61_openciares
  516.     moveq    #0,d0
  517.     move.l    4.w,a6
  518.     jsr    -$1f2(a6)
  519.     move.l    d0,P61_ciares-P61_cn(a3)
  520.     beq.b    P61_err
  521.     move.l    d0,a6
  522.     lea    P61_timerinterrupt(pc),a1
  523.     moveq    #0,d0
  524.     jsr    -6(a6)
  525.     tst.l    d0
  526.     beq.b    P61_gottimer
  527.     addq.l    #4,d3
  528.     lea    P61_timerinterrupt(pc),a1
  529.     moveq    #1,d0
  530.     jsr    -6(a6)
  531.     tst.l    d0
  532.     bne.b    P61_err
  533.  
  534. P61_gottimer
  535.     lea    P61_craddr+8(pc),a6
  536.     move.l    P61_ciaaddr(pc,d3),d0
  537.     move.l    d0,(a6)
  538.     sub    #$100,d0
  539.     move.l    d0,-(a6)
  540.     moveq    #2,d3
  541.     btst    #9,d0
  542.     bne.b    P61_timerB
  543.     subq.b    #1,d3
  544.     add    #$100,d0
  545. P61_timerB
  546.     add    #$900,d0
  547.     move.l    d0,-(a6)
  548.     move.l    d0,a0
  549.     and.b    #%10000000,(a0)
  550.     move.b    d3,P61_timeropen-P61_cn(a3)
  551.     moveq    #0,d0
  552.  
  553.     ifne    CIA
  554.     move.l    P61_craddr+4(pc),a1
  555.     move.b    P61_tlo(pc),(a1)
  556.     move.b    P61_thi(pc),$100(a1)
  557.     endc
  558.     or.b    #$19,(a0)
  559. P61_pois
  560.     move.l    (sp)+,a6
  561.     rts
  562.  
  563. P61_err    moveq    #-1,d0
  564.     bra.b    P61_pois
  565.     rts
  566.  
  567. P61_ciaaddr
  568.     dc.l    $bfd500,$bfd700
  569.     endc
  570.  
  571. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  572. ;­         Call P61_End to stop the music        ­
  573. ;­   A6 --> Customchip baseaddress ($DFF000)    ­
  574. ;­        Uses D0/D1/A0/A1/A3        ­
  575. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  576.  
  577.     xdef    P61_End
  578.  
  579. P61_End        movem.l    d0/d1/a0/a1/a3/a6,-(sp)
  580.         lea    $dff000,a6
  581.         bsr    _P61_End
  582.         movem.l    (sp)+,d0/d1/a0/a1/a3/a6
  583.         rts
  584.  
  585. _P61_End
  586.     moveq    #0,d0
  587.     move    d0,$a8(a6)
  588.     move    d0,$b8(a6)
  589.     move    d0,$c8(a6)
  590.     move    d0,$d8(a6)
  591.     move    #$f,$96(a6)
  592.  
  593.     and.b    #~2,$bfe001
  594.     move.b    P61_ofilter(pc),d0
  595.     or.b    d0,$bfe001
  596.  
  597.     ifeq    system
  598.     move    #$2000,$9a(a6)
  599.     move.l    P61_vektori(pc),a0
  600.     move.l    P61_oldlev6(pc),(a0)
  601.     lea    $bfd000,a0
  602.     lea    P61_Timers(pc),a1
  603.     move.b    (a1)+,$400(a0)
  604.     move.b    (a1)+,$500(a0)
  605.     move.b    (a1)+,$600(a0)
  606.     move.b    (a1)+,$700(a0)
  607.     move.b    #$10,$e00(a0)
  608.     move.b    #$10,$f00(a0)
  609.  
  610.     else
  611.     move.l    a6,-(sp)
  612.     lea    P61_cn(pc),a3
  613.     moveq    #0,d0
  614.     move.b    P61_timeropen(pc),d0
  615.     beq.b    P61_rem1
  616.     move.l    P61_ciares(pc),a6
  617.     lea    P61_timerinterrupt(pc),a1
  618.     subq.b    #1,d0
  619.     jsr    -12(a6)
  620. P61_rem1
  621.     move.l    4.w,a6
  622.     tst.b    P61_audioopen-P61_cn(a3)
  623.     beq.b    P61_rem2
  624.     lea    P61_allocreq(pc),a1
  625.     jsr    -$1c2(a6)
  626.     clr.b    P61_audioopen-P61_cn(a3)
  627. P61_rem2
  628.     moveq    #0,d0
  629.     move.b    P61_sigbit(pc),d0
  630.     bmi.b    P61_rem3
  631.     jsr    -$150(a6)
  632.     st    P61_sigbit-P61_cn(a3)
  633. P61_rem3
  634.     move.l    (sp)+,a6
  635.     endc
  636.     rts
  637.  
  638.     ifne    fade
  639. P61_mfade
  640.     move    P61_Master(pc),d0
  641.     move    P61_temp0+P61_Shadow(pc),d1
  642.     mulu    d0,d1
  643.     lsr    #6,d1
  644.     move    d1,$a8(a6)
  645.  
  646.     ifgt    channels-1
  647.     move    P61_temp1+P61_Shadow(pc),d1
  648.     mulu    d0,d1
  649.     lsr    #6,d1
  650.     move    d1,$b8(a6)
  651.     endc
  652.  
  653.     ifgt    channels-2
  654.     move    P61_temp2+P61_Shadow(pc),d1
  655.     mulu    d0,d1
  656.     lsr    #6,d1
  657.     move    d1,$c8(a6)
  658.     endc
  659.  
  660.     ifgt    channels-3
  661.     move    P61_temp3+P61_Shadow(pc),d1
  662.     mulu    d0,d1
  663.     lsr    #6,d1
  664.     move    d1,$d8(a6)
  665.     endc
  666.     rts
  667.     endc
  668.     
  669.  
  670. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  671. ;­ Call P61_SetPosition to jump to a specific    ­
  672. ;­          position in the song.        ­
  673. ;­ D0.l --> Position                ­
  674. ;­ Starts from the beginning if out of limits.    ­
  675. ;­              Uses A0/A1/A3/D0-D3        ­
  676. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  677.  
  678.     xdef    P61_SetPosition__i
  679.  
  680. P61_SetPosition__i
  681.     ifne    jump
  682.     move.l    4(sp),d0
  683.     movem.l    a0/a1/a3/d0-d3,-(sp)
  684.     lea    P61_cn(pc),a3
  685.     ifne    P61_pl
  686.     clr    P61_plflag-P61_cn(a3)
  687.     endc
  688.     moveq    #0,d1
  689.     move.b    d0,d1
  690.     move.l    d1,d0
  691.     cmp    P61_slen-P61_cn(a3),d0
  692.     blo.b    .e
  693.     moveq    #0,d0
  694. .e    move    d0,P61_Pos-P61_cn(a3)
  695.     add.l    P61_possibase(pc),d0
  696.     move.l    d0,P61_spos-P61_cn(a3)
  697.  
  698.     moveq    #64,d0
  699.     move    d0,P61_rowpos-P61_cn(a3)
  700.     clr    P61_CRow-P61_cn(a3)
  701.     move.l    P61_spos(pc),a1
  702.     move.l    P61_patternbase(pc),a0
  703.     addq    #1,P61_Pos-P61_cn(a3)
  704.     move.b    (a1)+,d0
  705.     move.l    a1,P61_spos-P61_cn(a3)
  706.     move.l    P61_positionbase(pc),a1
  707.     move    d0,P61_Patt-P61_cn(a3)
  708.     lsl    #3,d0
  709.     add.l    d0,a1
  710.     movem    (a1),d0-d3
  711.     lea    (a0,d0.l),a1
  712.     move    d1,d0
  713.     move.l    a1,P61_ChaPos+P61_temp0-P61_cn(a3)
  714.     lea    (a0,d0.l),a1
  715.     move.l    a1,P61_ChaPos+P61_temp1-P61_cn(a3)
  716.     move    d2,d0
  717.     lea    (a0,d0.l),a1
  718.     move.l    a1,P61_ChaPos+P61_temp2-P61_cn(a3)
  719.     move    d3,d0
  720.     add.l    d0,a0
  721.     move.l    a0,P61_ChaPos+P61_temp3-P61_cn(a3)
  722.     movem.l    (sp)+,a0/a1/a3/d0-d3
  723.     rts
  724.     endc
  725.  
  726. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  727. ;­ Call P61_Music every frame to play the music    ­
  728. ;­      _NOT_ if CIA-version is used!        ­
  729. ;­ A6 --> Customchip baseaddress ($DFF000)    ­
  730. ;­              Uses A0-A5/D0-D7        ­
  731. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  732.  
  733. P61_Music
  734.     lea    P61_cn(pc),a3
  735.  
  736.     tst    P61_Play-P61_cn(a3)
  737.     bne.b    P61_ohitaaa
  738.     ifne    CIA
  739.     ifne    system
  740.     move.l    P61_craddr+4(pc),a0
  741.     move.b    P61_tlo2(pc),(a0)
  742.     move.b    P61_thi2(pc),$100(a0)
  743.     endc
  744.     endc
  745.     rts
  746.  
  747. P61_ohitaaa
  748.     ifne    fade
  749.     pea    P61_mfade(pc)
  750.     endc
  751.  
  752.     moveq    #Channel_Block_SIZE,d6
  753.     moveq    #16,d7
  754.  
  755.     move    (a3),d4
  756.     addq    #1,d4
  757.     cmp    P61_speed(pc),d4
  758.     beq    P61_playtime
  759.  
  760.     move    d4,(a3)
  761.  
  762. P61_delay
  763.     ifne    CIA
  764.     ifne    system
  765.     move.l    P61_craddr+4(pc),a0
  766.     move.b    P61_tlo2(pc),(a0)
  767.     move.b    P61_thi2(pc),$100(a0)
  768.     endc
  769.     endc
  770.  
  771.     lea    P61_temp0(pc),a5
  772.     lea    $a0(a6),a4
  773.  
  774.     moveq    #channels-1,d5
  775. P61_lopas
  776.     tst    P61_OnOff(a5)
  777.     beq    P61_contfxdone
  778.     moveq    #$f,d0
  779.     and    (a5),d0
  780.     ifeq    opt020
  781.     add    d0,d0
  782.     move    P61_jtab2(pc,d0),d0
  783.     else
  784.     move    P61_jtab2(pc,d0*2),d0
  785.     endc
  786.     jmp    P61_jtab2(pc,d0)
  787.  
  788. P61_jtab2
  789.     dc    P61_contfxdone-P61_jtab2
  790.  
  791.     ifne    P61_pu
  792.     dc    P61_portup-P61_jtab2
  793.     else
  794.     dc    P61_contfxdone-P61_jtab2
  795.     endc
  796.  
  797.     ifne    P61_pd
  798.     dc    P61_portdwn-P61_jtab2
  799.     else
  800.     dc    P61_contfxdone-P61_jtab2
  801.     endc
  802.  
  803.     ifne    P61_tp
  804.     dc    P61_toneport-P61_jtab2
  805.     else
  806.     dc    P61_contfxdone-P61_jtab2
  807.     endc
  808.  
  809.     ifne    P61_vib
  810.     dc    P61_vib2-P61_jtab2
  811.     else
  812.     dc    P61_contfxdone-P61_jtab2
  813.     endc
  814.  
  815.     ifne    P61_tpvs
  816.     dc    P61_tpochvslide-P61_jtab2
  817.     else
  818.     dc    P61_contfxdone-P61_jtab2
  819.     endc
  820.  
  821.     ifne    P61_vbvs
  822.     dc    P61_vibochvslide-P61_jtab2
  823.     else
  824.     dc    P61_contfxdone-P61_jtab2
  825.     endc
  826.  
  827.     ifne    P61_tre
  828.     dc    P61_tremo-P61_jtab2
  829.     else
  830.     dc    P61_contfxdone-P61_jtab2
  831.     endc
  832.  
  833.     ifne    P61_arp
  834.     dc    P61_arpeggio-P61_jtab2
  835.     else
  836.     dc    P61_contfxdone-P61_jtab2
  837.     endc
  838.  
  839.     dc    P61_contfxdone-P61_jtab2
  840.  
  841.     ifne    P61_vs
  842.     dc    P61_volslide-P61_jtab2
  843.     else
  844.     dc    P61_contfxdone-P61_jtab2
  845.     endc
  846.  
  847.     dc    P61_contfxdone-P61_jtab2
  848.     dc    P61_contfxdone-P61_jtab2
  849.     dc    P61_contfxdone-P61_jtab2
  850.  
  851.     ifne    P61_ec
  852.     dc    P61_contecommands-P61_jtab2
  853.     else
  854.     dc    P61_contfxdone-P61_jtab2
  855.     endc
  856.     dc    P61_contfxdone-P61_jtab2
  857.  
  858.     ifne    P61_ec
  859. P61_contecommands
  860.     move.b    P61_Info(a5),d0
  861.     and    #$f0,d0
  862.     lsr    #3,d0
  863.     move    P61_etab2(pc,d0),d0
  864.     jmp    P61_etab2(pc,d0)
  865.  
  866. P61_etab2
  867.     dc    P61_contfxdone-P61_etab2
  868.  
  869.     ifne    P61_fsu
  870.     dc    P61_fineup2-P61_etab2
  871.     else
  872.     dc    P61_contfxdone-P61_etab2
  873.     endc
  874.  
  875.     ifne    P61_fsd
  876.     dc    P61_finedwn2-P61_etab2
  877.     else
  878.     dc    P61_contfxdone-P61_etab2
  879.     endc
  880.  
  881.     dc    P61_contfxdone-P61_etab2
  882.     dc    P61_contfxdone-P61_etab2
  883.  
  884.     dc    P61_contfxdone-P61_etab2
  885.     dc    P61_contfxdone-P61_etab2
  886.  
  887.     dc    P61_contfxdone-P61_etab2
  888.     dc    P61_contfxdone-P61_etab2
  889.  
  890.     ifne    P61_rt
  891.     dc    P61_retrig-P61_etab2
  892.     else
  893.     dc    P61_contfxdone-P61_etab2
  894.     endc
  895.  
  896.     ifne    P61_fvu
  897.     dc    P61_finevup2-P61_etab2
  898.     else
  899.     dc    P61_contfxdone-P61_etab2
  900.     endc
  901.  
  902.     ifne    P61_fvd
  903.     dc    P61_finevdwn2-P61_etab2
  904.     else
  905.     dc    P61_contfxdone-P61_etab2
  906.     endc
  907.  
  908.     ifne    P61_nc
  909.     dc    P61_notecut-P61_etab2
  910.     else
  911.     dc    P61_contfxdone-P61_etab2
  912.     endc
  913.  
  914.     ifne    P61_nd
  915.     dc    P61_notedelay-P61_etab2
  916.     else
  917.     dc    P61_contfxdone-P61_etab2
  918.     endc
  919.  
  920.     dc    P61_contfxdone-P61_etab2
  921.     dc    P61_contfxdone-P61_etab2
  922.     endc
  923.  
  924.     ifne    P61_fsu
  925. P61_fineup2
  926.     tst    (a3)
  927.     bne    P61_contfxdone
  928.     moveq    #$f,d0
  929.     and.b    P61_Info(a5),d0
  930.     sub    d0,P61_Period(a5)
  931.     moveq    #113,d0
  932.     cmp    P61_Period(a5),d0
  933.     ble.b    .jup
  934.     move    d0,P61_Period(a5)
  935. .jup    move    P61_Period(a5),6(a4)
  936.     bra    P61_contfxdone
  937.     endc
  938.  
  939.     ifne    P61_fsd
  940. P61_finedwn2
  941.     tst    (a3)
  942.     bne    P61_contfxdone
  943.     moveq    #$f,d0
  944.     and.b    P61_Info(a5),d0
  945.     add    d0,P61_Period(a5)
  946.     cmp    #856,P61_Period(a5)
  947.     ble.b    .jup
  948.     move    #856,P61_Period(a5)
  949. .jup    move    P61_Period(a5),6(a4)
  950.     bra    P61_contfxdone
  951.     endc
  952.  
  953.     ifne    P61_fvu
  954. P61_finevup2
  955.     tst    (a3)
  956.     bne    P61_contfxdone
  957.     moveq    #$f,d0
  958.     and.b    P61_Info(a5),d0
  959.     add    d0,P61_Volume(a5)
  960.     moveq    #64,d0
  961.     cmp    P61_Volume(a5),d0
  962.     bge.b    .jup
  963.     move    d0,P61_Volume(a5)
  964. .jup    move    P61_Volume(a5),8(a4)
  965.     bra    P61_contfxdone
  966.     endc
  967.  
  968.     ifne    P61_fvd
  969. P61_finevdwn2
  970.     tst    (a3)
  971.     bne    P61_contfxdone
  972.     moveq    #$f,d0
  973.     and.b    P61_Info(a5),d0
  974.     sub    d0,P61_Volume(a5)
  975.     bpl.b    .jup
  976.     clr    P61_Volume(a5)
  977. .jup    move    P61_Volume(a5),8(a4)
  978.     bra    P61_contfxdone
  979.     endc
  980.  
  981.     ifne    P61_nc
  982. P61_notecut
  983.     moveq    #$f,d0
  984.     and.b    P61_Info(a5),d0
  985.     cmp    (a3),d0
  986.     bne    P61_contfxdone
  987.     ifeq    fade
  988.     clr    8(a4)
  989.     else
  990.     clr    P61_Shadow(a5)
  991.     endc
  992.     clr    P61_Volume(a5)
  993.     bra    P61_contfxdone
  994.     endc
  995.  
  996.     ifne    P61_nd
  997. P61_notedelay
  998.     moveq    #$f,d0
  999.     and.b    P61_Info(a5),d0
  1000.     cmp    (a3),d0
  1001.     bne    P61_contfxdone
  1002.  
  1003.     moveq    #$7e,d0
  1004.     and.b    (a5),d0
  1005.     beq    P61_contfxdone
  1006.     move    P61_DMABit(a5),d0
  1007.     move    d0,$96(a6)
  1008.     or    d0,P61_dma-P61_cn(a3)
  1009.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1010.     move.l    (a1)+,(a4)+            ;Pointer
  1011.     move    (a1),(a4)+            ;Length
  1012.     move    P61_Period(a5),(a4)
  1013.     subq.l    #6,a4
  1014.  
  1015.     ifeq    system
  1016.     lea    P61_dmason(pc),a1
  1017.     move.l    P61_vektori(pc),a0
  1018.     move.l    a1,(a0)
  1019.     move.b    #$f0,$bfd600
  1020.     move.b    #$01,$bfd700
  1021.     move.b    #$19,$bfdf00
  1022.     else
  1023.     move    #1,P61_server-P61_cn(a3)
  1024.     move.l    P61_craddr+4(pc),a1
  1025.     move.b    #$f0,(a1)
  1026.     move.b    #1,$100(a1)
  1027.     endc
  1028.     bra    P61_contfxdone
  1029.     endc
  1030.  
  1031.     ifne    P61_rt
  1032. P61_retrig
  1033.     subq    #1,P61_RetrigCount(a5)
  1034.     bne    P61_contfxdone
  1035.     move    P61_DMABit(a5),d0
  1036.     move    d0,$96(a6)
  1037.     or    d0,P61_dma-P61_cn(a3)
  1038.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1039.     move.l    (a1)+,(a4)            ;Pointer
  1040.     move    (a1),4(a4)            ;Length
  1041.  
  1042.     ifeq    system
  1043.     lea    P61_dmason(pc),a1
  1044.     move.l    P61_vektori(pc),a0
  1045.     move.l    a1,(a0)
  1046.     move.b    #$f0,$bfd600
  1047.     move.b    #$01,$bfd700
  1048.     move.b    #$19,$bfdf00
  1049.     else
  1050.     move    #1,P61_server-P61_cn(a3)
  1051.     move.l    P61_craddr+4(pc),a1
  1052.     move.b    #$f0,(a1)
  1053.     move.b    #1,$100(a1)
  1054.     endc
  1055.  
  1056.     moveq    #$f,d0
  1057.     and.b    P61_Info(a5),d0
  1058.     move    d0,P61_RetrigCount(a5)
  1059.     bra    P61_contfxdone
  1060.     endc
  1061.  
  1062.     ifne    P61_arp
  1063. P61_arplist
  1064.     dc.b 0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1
  1065.  
  1066. P61_arpeggio
  1067.     move    (a3),d0
  1068.     move.b    P61_arplist(pc,d0),d0
  1069.     beq.b    .arp0
  1070.     subq.b    #1,d0
  1071.     beq.b    P61_arp1
  1072.     moveq    #$f,d0
  1073.     and.b    P61_Info(a5),d0
  1074.     bra.b    P61_arp3
  1075.  
  1076. .arp0    move    P61_Note(a5),d0
  1077.     move    P61_periods(pc,d0),6(a4)
  1078.     bra    P61_contfxdone
  1079. P61_arp1
  1080.     move.b    P61_Info(a5),d0
  1081.     lsr    #4,d0
  1082. P61_arp3
  1083.     add    d0,d0
  1084.     add    P61_Note(a5),d0
  1085.     move    P61_periods(pc,d0),6(a4)
  1086.     bra    P61_contfxdone
  1087.     endc
  1088.  
  1089. P61_periods
  1090.     ifne    P61_ft
  1091.     incbin    Hilda:Music/Player6.1a/Source/periods
  1092.     else
  1093.     incbin    periods.nft
  1094.     endc
  1095.  
  1096.     ifne    P61_vs
  1097. P61_volslide
  1098.     move.b    P61_Info(a5),d0
  1099.     sub.b    d0,P61_Volume+1(a5)
  1100.     bpl.b    .test
  1101.     clr    P61_Volume(a5)
  1102.     ifeq    fade
  1103.     clr    8(a4)
  1104.     else
  1105.     clr    P61_Shadow(a5)
  1106.     endc
  1107.     bra    P61_contfxdone
  1108. .test    moveq    #64,d0
  1109.     cmp    P61_Volume(a5),d0
  1110.     bge.b    .ncs
  1111.     move    d0,P61_Volume(a5)
  1112.     ifeq    fade
  1113.     move    d0,8(a4)
  1114.     else
  1115.     move    d0,P61_Shadow(a5)
  1116.     endc
  1117.     bra.b    P61_contfxdone
  1118. .ncs
  1119.     ifeq    fade
  1120.     move    P61_Volume(a5),8(a4)
  1121.     else
  1122.     move    P61_Volume(a5),P61_Shadow(a5)
  1123.     endc
  1124.     bra.b    P61_contfxdone
  1125.     endc
  1126.  
  1127.     ifne    P61_tpvs
  1128. P61_tpochvslide
  1129.     move.b    P61_Info(a5),d0
  1130.     sub.b    d0,P61_Volume+1(a5)
  1131.     bpl.b    .test
  1132.     clr    P61_Volume(a5)
  1133.     ifeq    fade
  1134.     clr    8(a4)
  1135.     else
  1136.     clr    P61_Shadow(a5)
  1137.     endc
  1138.     bra.b    P61_toneport
  1139. .test    moveq    #64,d0
  1140.     cmp    P61_Volume(a5),d0
  1141.     bge.b    .ncs
  1142.     move    d0,P61_Volume(a5)
  1143. .ncs
  1144.     ifeq    fade
  1145.     move    P61_Volume(a5),8(a4)
  1146.     else
  1147.     move    P61_Volume(a5),P61_Shadow(a5)
  1148.     endc
  1149.     endc
  1150.  
  1151.     ifne    P61_tp
  1152. P61_toneport
  1153.     move    P61_ToPeriod(a5),d0
  1154.     beq.b    P61_contfxdone
  1155.     move    P61_TPSpeed(a5),d1
  1156.     cmp    P61_Period(a5),d0
  1157.     blt.b    .topoup
  1158.  
  1159.     add    d1,P61_Period(a5)
  1160.     cmp    P61_Period(a5),d0
  1161.     bgt.b    P61_toposetper
  1162.     move    d0,P61_Period(a5)
  1163.     clr    P61_ToPeriod(a5)
  1164.     move    d0,6(a4)
  1165.     bra.b    P61_contfxdone
  1166.  
  1167. .topoup
  1168.     sub    d1,P61_Period(a5)
  1169.     cmp    P61_Period(a5),d0
  1170.     blt.b    P61_toposetper
  1171.     move    d0,P61_Period(a5)
  1172.     clr    P61_ToPeriod(a5)
  1173. P61_toposetper
  1174.     move    P61_Period(a5),6(a4)
  1175.     else
  1176.     nop
  1177.     endc
  1178.  
  1179. P61_contfxdone
  1180.     ifne    P61_il
  1181.     bsr    P61_funk2
  1182.     endc
  1183.  
  1184.     add.l    d6,a5
  1185.     add.l    d7,a4
  1186.     dbf    d5,P61_lopas
  1187.  
  1188.     cmp    P61_speed2(pc),d4
  1189.     beq.b    P61_preplay
  1190.     rts
  1191.  
  1192.     ifne    P61_pu
  1193. P61_portup
  1194.     moveq    #0,D0
  1195.     move.b    P61_Info(a5),d0
  1196.     sub    d0,P61_Period(a5)
  1197.     moveq    #113,d0
  1198.     cmp    P61_Period(a5),d0
  1199.     ble.b    .skip
  1200.     move    d0,P61_Period(a5)
  1201.     move    d0,6(a4)
  1202.     bra.b    P61_contfxdone
  1203. .skip
  1204.     move    P61_Period(a5),6(a4)
  1205.     bra.b    P61_contfxdone
  1206.     endc
  1207.  
  1208.     ifne    P61_pd
  1209. P61_portdwn
  1210.     moveq    #0,d0
  1211.     move.b    P61_Info(a5),d0
  1212.     add    d0,P61_Period(a5)
  1213.     cmp    #856,P61_Period(a5)
  1214.     ble.b    .skip
  1215.     move    #856,d0
  1216.     move    d0,P61_Period(a5)
  1217.     move    d0,6(a4)
  1218.     bra.b    P61_contfxdone
  1219. .skip
  1220.     move    P61_Period(a5),6(a4)
  1221.     bra.b    P61_contfxdone
  1222.     endc
  1223.  
  1224.     ifne    P61_pde
  1225. P61_return
  1226.     rts
  1227.  
  1228. P61_preplay
  1229.     tst    P61_pdflag-P61_cn(a3)
  1230.     bne.b    P61_return
  1231.     else
  1232. P61_preplay
  1233.     endc
  1234.  
  1235.     lea    P61_temp0(pc),a5
  1236.     lea    P61_Samples-16(pc),a0
  1237.  
  1238.     moveq    #channels-1,d5
  1239. P61_loaps
  1240.     ifne    P61_pl
  1241.     lea    P61_TData(a5),a1
  1242.     move    2(a5),(a1)+
  1243.     move.l    P61_ChaPos(a5),(a1)+
  1244.     move.l    P61_TempPos(a5),(a1)+
  1245.     move    P61_TempLen(a5),(a1)
  1246.     endc
  1247.  
  1248.     move.b    P61_Pack(a5),d0
  1249.     and.b    #$3f,d0
  1250.     beq.b    P61_takeone
  1251.  
  1252.     tst.b    P61_Pack(a5)
  1253.     bmi.b    .keepsame
  1254.  
  1255.     subq.b    #1,P61_Pack(a5)
  1256.     clr    P61_OnOff(a5)            ; Empty row
  1257.     add.l    d6,a5
  1258.     dbf    d5,P61_loaps
  1259.     rts
  1260.  
  1261. .keepsame
  1262.     subq.b    #1,P61_Pack(a5)
  1263.     bra    P61_dko
  1264.  
  1265. P61_takeone
  1266.     tst.b    P61_TempLen+1(a5)
  1267.     beq    P61_takenorm
  1268.  
  1269.     subq.b    #1,P61_TempLen+1(a5)
  1270.     move.l    P61_TempPos(a5),a2
  1271.  
  1272. P61_jedi
  1273.     move.b    (a2)+,d0
  1274.     moveq    #%01100000,d1
  1275.     and.b    d0,d1
  1276.     cmp.b    #%01100000,d1
  1277.     bne.b    .all
  1278.  
  1279.     moveq    #%01110000,d1
  1280.     and.b    d0,d1
  1281.     cmp.b    #%01110000,d1
  1282.     bne.b    .cmd
  1283.  
  1284.     moveq    #%01111000,d1
  1285.     and.b    d0,d1
  1286.     cmp.b    #%01111000,d1
  1287.     bne.b    .note
  1288.  
  1289. .empty    clr    P61_OnOff(a5)            ; Empty row
  1290.     clr    (a5)+
  1291.     clr.b    (a5)+
  1292.     tst.b    d0
  1293.     bpl.b    .ex
  1294.     move.b    (a2)+,(a5)            ; Compression info
  1295.     bra.b    .ex
  1296.  
  1297. .all    move.b    d0,(a5)+
  1298.     ifeq    opt020
  1299.     move.b    (a2)+,(a5)+
  1300.     move.b    (a2)+,(a5)+
  1301.     else
  1302.     move    (a2)+,(a5)+
  1303.     endc
  1304.     tst.b    d0
  1305.     bpl.b    .ex
  1306.     move.b    (a2)+,(a5)            ; Compression info
  1307.     bra.b    .ex
  1308.  
  1309. .cmd    moveq    #$f,d1
  1310.     and    d0,d1
  1311.     move    d1,(a5)+            ; cmd
  1312.     move.b    (a2)+,(a5)+            ; info
  1313.     tst.b    d0
  1314.     bpl.b    .ex
  1315.     move.b    (a2)+,(a5)            ; Compression info
  1316.     bra.b    .ex
  1317.  
  1318. .note    moveq    #7,d1
  1319.     and    d0,d1
  1320.     lsl    #8,d1
  1321.     move.b    (a2)+,d1
  1322.     lsl    #4,d1
  1323.     move    d1,(a5)+
  1324.     clr.b    (a5)+    
  1325.     tst.b    d0
  1326.     bpl.b    .ex
  1327.     move.b    (a2)+,(a5)            ; Compression info
  1328. .ex    subq.l    #3,a5
  1329.     move.l    a2,P61_TempPos(a5)
  1330.     bra    P61_dko
  1331.  
  1332.  
  1333. P61_takenorm
  1334.     move.l    P61_ChaPos(a5),a2
  1335.  
  1336.     move.b    (a2)+,d0
  1337.     moveq    #%01100000,d1
  1338.     and.b    d0,d1
  1339.     cmp.b    #%01100000,d1
  1340.     bne.b    .all
  1341.  
  1342.     moveq    #%01110000,d1
  1343.     and.b    d0,d1
  1344.     cmp.b    #%01110000,d1
  1345.     bne.b    .cmd
  1346.  
  1347.     moveq    #%01111000,d1
  1348.     and.b    d0,d1
  1349.     cmp.b    #%01111000,d1
  1350.     bne.b    .note
  1351.  
  1352. .empty    clr    P61_OnOff(a5)            ; Empty row
  1353.     clr    (a5)+
  1354.     clr.b    (a5)+
  1355.     tst.b    d0
  1356.     bpl.b    .proccomp
  1357.     move.b    (a2)+,(a5)            ; Compression info
  1358.     bra.b    .proccomp
  1359.  
  1360.  
  1361. .all    move.b    d0,(a5)+
  1362.     ifeq    opt020
  1363.     move.b    (a2)+,(a5)+
  1364.     move.b    (a2)+,(a5)+
  1365.     else
  1366.     move    (a2)+,(a5)+
  1367.     endc
  1368.     tst.b    d0
  1369.     bpl.b    .proccomp
  1370.     move.b    (a2)+,(a5)            ; Compression info
  1371.     bra.b    .proccomp
  1372.  
  1373. .cmd    moveq    #$f,d1
  1374.     and    d0,d1
  1375.     move    d1,(a5)+            ; cmd
  1376.     move.b    (a2)+,(a5)+            ; info
  1377.     tst.b    d0
  1378.     bpl.b    .proccomp
  1379.     move.b    (a2)+,(a5)            ; Compression info
  1380.     bra.b    .proccomp
  1381.  
  1382. .note    moveq    #7,d1
  1383.     and    d0,d1
  1384.     lsl    #8,d1
  1385.     move.b    (a2)+,d1
  1386.     lsl    #4,d1
  1387.     move    d1,(a5)+
  1388.     clr.b    (a5)+    
  1389.     tst.b    d0
  1390.     bpl.b    .proccomp
  1391.     move.b    (a2)+,(a5)            ; Compression info
  1392.  
  1393. .proccomp
  1394.     subq.l    #3,a5
  1395.     move.l    a2,P61_ChaPos(a5)
  1396.  
  1397.     tst.b    d0
  1398.     bpl.b    P61_dko
  1399.  
  1400.     move.b    3(a5),d0
  1401.     move.b    d0,d1
  1402.     and    #%11000000,d1
  1403.     beq.b    P61_dko                ; Empty datas
  1404.     cmp.b    #%10000000,d1
  1405.     beq.b    P61_dko                ; Same datas
  1406.  
  1407.     clr.b    3(a5)
  1408.     and    #$3f,d0
  1409.     move.b    d0,P61_TempLen+1(a5)
  1410.  
  1411.     cmp.b    #%11000000,d1
  1412.     beq.b    .bit16                ; 16-bit
  1413.  
  1414.     moveq    #0,d0                ; 8-bit
  1415.     move.b    (a2)+,d0
  1416.     move.l    a2,P61_ChaPos(a5)
  1417.     sub.l    d0,a2
  1418.     bra    P61_jedi
  1419.  
  1420. .bit16    moveq    #0,d0
  1421.     ifeq    opt020
  1422.     move.b    (a2)+,d0
  1423.     lsl    #8,d0
  1424.     move.b    (a2)+,d0
  1425.     else
  1426.     move    (a2)+,d0
  1427.     endc
  1428.  
  1429.     move.l    a2,P61_ChaPos(a5)
  1430.     sub.l    d0,a2
  1431.     bra    P61_jedi
  1432.  
  1433.  
  1434. P61_dko    st    P61_OnOff(a5)
  1435.     move    (a5),d0
  1436.     and    #$1f0,d0
  1437.     beq.b    .koto
  1438.     lea    (a0,d0),a1
  1439.     move.l    a1,P61_Sample(a5)
  1440.     ifne    P61_ft
  1441.     move.l    P61_SampleVolume(a1),P61_Volume(a5)
  1442.     else
  1443.     move    P61_SampleVolume(a1),P61_Volume(a5)
  1444.     endc
  1445.     ifne    P61_il
  1446.     move.l    P61_RepeatOffset(a1),P61_Wave(a5)
  1447.     endc
  1448.     ifne    P61_sof
  1449.     clr    P61_Offset(a5)
  1450.     endc
  1451.  
  1452. .koto    add.l    d6,a5
  1453.     dbf    d5,P61_loaps
  1454.     rts
  1455.  
  1456. P61_playtime
  1457.     clr    (a3)
  1458.  
  1459.     ifne    P61_pde
  1460.     tst    P61_pdelay-P61_cn(a3)
  1461.     beq.b    .djdj
  1462.     subq    #1,P61_pdelay-P61_cn(a3)
  1463.     bra    P61_delay
  1464. .djdj
  1465.     endc
  1466.  
  1467.     clr    P61_pdflag-P61_cn(a3)
  1468.  
  1469.     tst    P61_speedis1-P61_cn(a3)
  1470.     beq.b    .mo
  1471.     bsr    P61_preplay
  1472.  
  1473. .mo    lea    P61_temp0(pc),a5
  1474.     lea    $a0(a6),a4
  1475.  
  1476.     ifeq    system
  1477.     lea    P61_dmason(pc),a1
  1478.     move.l    P61_vektori(pc),a0
  1479.     move.l    a1,(a0)
  1480.     move.b    #$f0,$bfd600
  1481.     move.b    #$01,$bfd700
  1482.     move.b    #$19,$bfdf00
  1483.     else
  1484.     move    #1,P61_server-P61_cn(a3)
  1485.     move.l    P61_craddr+4(pc),a1
  1486.     move.b    #$f0,(a1)
  1487.     move.b    #1,$100(a1)
  1488.     endc
  1489.  
  1490.     lea    P61_periods(pc),a2
  1491.  
  1492.     moveq    #0,d4
  1493.     moveq    #channels-1,d5
  1494. P61_los    tst    P61_OnOff(a5)
  1495.     beq    P61_nocha
  1496.  
  1497.     moveq    #$f,d0
  1498.     and    (a5),d0
  1499.     lea    P61_jtab(pc),a1
  1500.     add    d0,d0
  1501.     add.l    d0,a1
  1502.     add    (a1),a1
  1503.     jmp    (a1)
  1504.  
  1505. P61_fxdone
  1506.     moveq    #$7e,d0
  1507.     and.b    (a5),d0
  1508.     beq.b    P61_nocha
  1509.     ifne    P61_vib
  1510.     clr.b    P61_VibPos(a5)
  1511.     endc
  1512.     ifne    P61_tre
  1513.     clr.b    P61_TrePos(a5)
  1514.     endc
  1515.  
  1516.      ifne    P61_ft
  1517.     add    P61_Fine(a5),d0
  1518.     endc
  1519.     move    d0,P61_Note(a5)
  1520.     move    (a2,d0),P61_Period(a5)
  1521.  
  1522. P61_zample
  1523.     ifne    P61_sof
  1524.     tst    P61_Offset(a5)
  1525.     bne    P61_pek
  1526.     endc
  1527.  
  1528.     or    P61_DMABit(a5),d4
  1529.     move    d4,$96(a6)
  1530.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1531.     move.l    (a1)+,(a4)            ;Pointer
  1532.     move    (a1),4(a4)            ;Length
  1533.  
  1534. P61_nocha
  1535.     ifeq    fade
  1536.     move.l    P61_Period(a5),6(a4)
  1537.     else
  1538.     move    P61_Period(a5),6(a4)
  1539.     move    P61_Volume(a5),P61_Shadow(a5)
  1540.     endc
  1541.  
  1542. P61_skip
  1543.     ifne    P61_il
  1544.     bsr    P61_funk2
  1545.     endc
  1546.  
  1547.     add.l    d6,a5
  1548.     add.l    d7,a4
  1549.     dbf    d5,P61_los
  1550.  
  1551.     move.b    d4,P61_dma+1-P61_cn(a3)
  1552.  
  1553.     ifne    P61_pl
  1554.     tst.b    P61_plflag+1-P61_cn(a3)
  1555.     beq.b    P61_ohittaa
  1556.  
  1557.     lea    P61_temp0(pc),a1
  1558.     lea    P61_looppos(pc),a0
  1559.     moveq    #channels-1,d0
  1560. .talt    move.b    1(a0),3(a1)
  1561.     addq.l    #2,a0
  1562.     move.l    (a0)+,P61_ChaPos(a1)
  1563.     move.l    (a0)+,P61_TempPos(a1)
  1564.     move    (a0)+,P61_TempLen(a1)
  1565.     add.l    d6,a1
  1566.     dbf    d0,.talt
  1567.  
  1568.     move    P61_plrowpos(pc),P61_rowpos-P61_cn(a3)
  1569.     clr.b    P61_plflag+1-P61_cn(a3)
  1570.     moveq    #63,d0
  1571.     sub    P61_rowpos-P61_cn(a3),d0
  1572.     move    d0,P61_CRow-P61_cn(a3)
  1573.     rts
  1574.     endc
  1575.  
  1576. P61_ohittaa
  1577.     subq    #1,P61_rowpos-P61_cn(a3)
  1578.     bmi.b    P61_nextpattern
  1579.     moveq    #63,d0
  1580.     sub    P61_rowpos-P61_cn(a3),d0
  1581.     move    d0,P61_CRow-P61_cn(a3)
  1582.     rts
  1583.  
  1584. P61_nextpattern
  1585.     ifne    P61_pl
  1586.     clr    P61_plflag-P61_cn(a3)
  1587.     endc
  1588.     move.l    P61_patternbase(pc),a4
  1589.     moveq    #63,d0
  1590.     move    d0,P61_rowpos-P61_cn(a3)
  1591.     clr    P61_CRow-P61_cn(a3)
  1592.     move.l    P61_spos(pc),a1
  1593.     addq    #1,P61_Pos-P61_cn(a3)
  1594.     move.b    (a1)+,d0
  1595.     bpl.b    P61_dk
  1596.     move.l    P61_possibase(pc),a1
  1597.     move.b    (a1)+,d0
  1598.     clr    P61_Pos-P61_cn(a3)
  1599. P61_dk    move.l    a1,P61_spos-P61_cn(a3)
  1600.     move    d0,P61_Patt-P61_cn(a3)
  1601.     lsl    #3,d0
  1602.     move.l    P61_positionbase(pc),a1
  1603.     add.l    d0,a1
  1604.  
  1605.     move    (a1)+,d0
  1606.     lea    (a4,d0.l),a2
  1607.     move.l    a2,P61_ChaPos+P61_temp0-P61_cn(a3)
  1608.     move    (a1)+,d0
  1609.     lea    (a4,d0.l),a2
  1610.     move.l    a2,P61_ChaPos+P61_temp1-P61_cn(a3)
  1611.     move    (a1)+,d0
  1612.     lea    (a4,d0.l),a2
  1613.     move.l    a2,P61_ChaPos+P61_temp2-P61_cn(a3)
  1614.     move    (a1),d0
  1615.     add.l    d0,a4
  1616.     move.l    a4,P61_ChaPos+P61_temp3-P61_cn(a3)
  1617.     rts
  1618.  
  1619.     ifne    P61_tp
  1620. P61_settoneport
  1621.     move.b    P61_Info(a5),d0
  1622.     beq.b    P61_toponochange
  1623.     move.b    d0,P61_TPSpeed+1(a5)
  1624. P61_toponochange
  1625.     moveq    #$7e,d0
  1626.     and.b    (a5),d0
  1627.     beq    P61_nocha
  1628.     add    P61_Fine(a5),d0
  1629.     move    d0,P61_Note(a5)
  1630.     move    (a2,d0),P61_ToPeriod(a5)
  1631.     bra    P61_nocha
  1632.     endc
  1633.  
  1634.     ifne    P61_sof
  1635. P61_sampleoffse
  1636.     moveq    #$7e,d0
  1637.     and.b    (a5),d0
  1638.     beq    P61_nocha
  1639.     ifne    P61_vib
  1640.     clr.b    P61_VibPos(a5)
  1641.     endc
  1642.     ifne    P61_tre
  1643.     clr.b    P61_TrePos(a5)
  1644.     endc
  1645.  
  1646.     ifne    P61_ft
  1647.     add    P61_Fine(a5),d0
  1648.     endc
  1649.     move    d0,P61_Note(a5)
  1650.     move    (a2,d0),P61_Period(a5)
  1651.  
  1652.     moveq    #0,d1
  1653.     move    #$ff00,d1
  1654.     and    2(a5),d1
  1655.     bne.b    .deq
  1656.     move    P61_LOffset(a5),d1
  1657. .deq    move    d1,P61_LOffset(a5)
  1658.     add    d1,P61_Offset(a5)
  1659.     move    P61_Offset(a5),d2
  1660.  
  1661.     add    d1,P61_Offset(a5)        ; THIS IS A PT-FEATURE!
  1662.     bra.b    P61_hup
  1663.  
  1664. P61_pek    moveq    #0,d1
  1665.     move    P61_Offset(a5),d1
  1666. P61_hup    or    P61_DMABit(a5),d4
  1667.     move    d4,$96(a6)
  1668.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1669.     move.l    (a1)+,d0
  1670.     add.l    d1,d0
  1671.     move.l    d0,(a4)                ;Pointer
  1672.     lsr    #1,d1
  1673.     move    (a1),d0
  1674.     sub    d1,d0
  1675.     bpl.b    P61_offok
  1676.     move.l    -4(a1),(a4)            ;Pointer is over the end
  1677.     moveq    #1,d0
  1678. P61_offok
  1679.     move    d0,4(a4)            ;Length
  1680.     bra    P61_nocha
  1681.     endc
  1682.  
  1683.     ifne    P61_vl
  1684. P61_volum
  1685.     move.b    P61_Info(a5),P61_Volume+1(a5)
  1686.     bra    P61_fxdone
  1687.     endc
  1688.  
  1689.     ifne    P61_pj
  1690. P61_posjmp
  1691.     moveq    #0,d0
  1692.     move.b    P61_Info(a5),d0
  1693.     cmp    P61_slen-P61_cn(a3),d0
  1694.     blo.b    .e
  1695.     moveq    #0,d0
  1696. .e    move    d0,P61_Pos-P61_cn(a3)
  1697.     add.l    P61_possibase(pc),d0
  1698.     move.l    d0,P61_spos-P61_cn(a3)
  1699.     endc
  1700.  
  1701.     ifne    P61_pb
  1702. P61_pattbreak
  1703.     moveq    #64,d0
  1704.     move    d0,P61_rowpos-P61_cn(a3)
  1705.     clr    P61_CRow-P61_cn(a3)
  1706.     move.l    P61_spos(pc),a1
  1707.     move.l    P61_patternbase(pc),a0
  1708.     addq    #1,P61_Pos-P61_cn(a3)
  1709.     move.b    (a1)+,d0
  1710.     bpl.b    P61_dk2
  1711.     move.l    P61_possibase(pc),a1
  1712.     move.b    (a1)+,d0
  1713.     clr    P61_Pos-P61_cn(a3)
  1714. P61_dk2    move.l    a1,P61_spos-P61_cn(a3)
  1715.     move.l    P61_positionbase(pc),a1
  1716.     move    d0,P61_Patt-P61_cn(a3)
  1717.     lsl    #3,d0
  1718.     add.l    d0,a1
  1719.     movem    (a1),d0-d3
  1720.     lea    (a0,d0.l),a1
  1721.     move    d1,d0
  1722.     move.l    a1,P61_ChaPos+P61_temp0-P61_cn(a3)
  1723.     lea    (a0,d0.l),a1
  1724.     move.l    a1,P61_ChaPos+P61_temp1-P61_cn(a3)
  1725.     move    d2,d0
  1726.     lea    (a0,d0.l),a1
  1727.     move.l    a1,P61_ChaPos+P61_temp2-P61_cn(a3)
  1728.     move    d3,d0
  1729.     add.l    d0,a0
  1730.     move.l    a0,P61_ChaPos+P61_temp3-P61_cn(a3)
  1731.     bra    P61_fxdone
  1732.     endc
  1733.  
  1734.     ifne    P61_vib
  1735. P61_vibrato
  1736.     move.b    P61_Info(a5),d0
  1737.     beq    P61_fxdone
  1738.     move.b    d0,d1
  1739.     move.b    P61_VibCmd(a5),d2
  1740.     and.b    #$f,d0
  1741.     beq.b    P61_vibskip
  1742.     and.b    #$f0,d2
  1743.     or.b    d0,d2
  1744. P61_vibskip
  1745.     and.b    #$f0,d1
  1746.     beq.b    P61_vibskip2
  1747.     and.b    #$f,d2
  1748.     or.b    d1,d2
  1749. P61_vibskip2
  1750.     move.b    d2,P61_VibCmd(a5)
  1751.     bra    P61_fxdone
  1752.     endc
  1753.  
  1754.     ifne    P61_tre
  1755. P61_settremo
  1756.     move.b    P61_Info(a5),d0
  1757.     beq    P61_fxdone
  1758.     move.b    d0,d1
  1759.     move.b    P61_TreCmd(a5),d2
  1760.     moveq    #$f,d3
  1761.     and.b    d3,d0
  1762.     beq.b    P61_treskip
  1763.     and.b    #$f0,d2
  1764.     or.b    d0,d2
  1765. P61_treskip
  1766.     and.b    #$f0,d1
  1767.     beq.b    P61_treskip2
  1768.     and.b    d3,d2
  1769.     or.b    d1,d2
  1770. P61_treskip2
  1771.     move.b    d2,P61_TreCmd(a5)
  1772.     bra    P61_fxdone
  1773.     endc
  1774.  
  1775.     ifne    P61_ec
  1776. P61_ecommands
  1777.     move.b    P61_Info(a5),d0
  1778.     and.b    #$f0,d0
  1779.     lsr    #3,d0
  1780.     move    P61_etab(pc,d0),d0
  1781.     jmp    P61_etab(pc,d0)
  1782.  
  1783. P61_etab
  1784.     ifne    P61_fi
  1785.     dc    P61_filter-P61_etab
  1786.     else
  1787.     dc    P61_fxdone-P61_etab
  1788.     endc
  1789.  
  1790.     ifne    P61_fsu
  1791.     dc    P61_fineup-P61_etab
  1792.     else
  1793.     dc    P61_fxdone-P61_etab
  1794.     endc
  1795.  
  1796.     ifne    P61_fsd
  1797.     dc    P61_finedwn-P61_etab
  1798.     else
  1799.     dc    P61_fxdone-P61_etab
  1800.     endc
  1801.  
  1802.     dc    P61_fxdone-P61_etab
  1803.     dc    P61_fxdone-P61_etab
  1804.  
  1805.     ifne    P61_sft
  1806.     dc    P61_setfinetune-P61_etab
  1807.     else
  1808.     dc    P61_fxdone-P61_etab
  1809.     endc
  1810.  
  1811.     ifne    P61_pl
  1812.     dc    P61_patternloop-P61_etab
  1813.     else
  1814.     dc    P61_fxdone-P61_etab
  1815.     endc
  1816.  
  1817.     dc    P61_fxdone-P61_etab
  1818.  
  1819.     ifne    P61_timing
  1820.     dc    P61_sete8-P61_etab
  1821.     else
  1822.     dc    P61_fxdone-P61_etab
  1823.     endc
  1824.  
  1825.     ifne    P61_rt
  1826.     dc    P61_setretrig-P61_etab
  1827.     else
  1828.     dc    P61_fxdone-P61_etab
  1829.     endc
  1830.  
  1831.     ifne    P61_fvu
  1832.     dc    P61_finevup-P61_etab
  1833.     else
  1834.     dc    P61_fxdone-P61_etab
  1835.     endc
  1836.  
  1837.     ifne    P61_fvd
  1838.     dc    P61_finevdwn-P61_etab
  1839.     else
  1840.     dc    P61_fxdone-P61_etab
  1841.     endc
  1842.  
  1843.     dc    P61_fxdone-P61_etab
  1844.  
  1845.     ifne    P61_nd
  1846.     dc    P61_ndelay-P61_etab
  1847.     else
  1848.     dc    P61_fxdone-P61_etab
  1849.     endc
  1850.  
  1851.     ifne    P61_pde
  1852.     dc    P61_pattdelay-P61_etab
  1853.     else
  1854.     dc    P61_fxdone-P61_etab
  1855.     endc
  1856.  
  1857.     ifne    P61_il
  1858.     dc    P61_funk-P61_etab
  1859.     else
  1860.     dc    P61_fxdone-P61_etab
  1861.     endc
  1862.     endc
  1863.  
  1864.     ifne    P61_fi
  1865. P61_filter
  1866.     move.b    P61_Info(a5),d0
  1867.     and.b    #$fd,$bfe001
  1868.     or.b    d0,$bfe001
  1869.     bra    P61_fxdone
  1870.     endc
  1871.  
  1872.     ifne    P61_fsu
  1873. P61_fineup
  1874.     P61_getnote
  1875.  
  1876.     moveq    #$f,d0
  1877.     and.b    P61_Info(a5),d0
  1878.     sub    d0,P61_Period(a5)
  1879.     moveq    #113,d0
  1880.     cmp    P61_Period(a5),d0
  1881.     ble.b    .jup
  1882.     move    d0,P61_Period(a5)
  1883. .jup    moveq    #$7e,d0
  1884.     and.b    (a5),d0
  1885.     bne    P61_zample
  1886.     bra    P61_nocha
  1887.     endc
  1888.  
  1889.     ifne    P61_fsd
  1890. P61_finedwn
  1891.     P61_getnote
  1892.  
  1893.     moveq    #$f,d0
  1894.     and.b    P61_Info(a5),d0
  1895.     add    d0,P61_Period(a5)
  1896.     cmp    #856,P61_Period(a5)
  1897.     ble.b    .jup
  1898.     move    #856,P61_Period(a5)
  1899. .jup    moveq    #$7e,d0
  1900.     and.b    (a5),d0
  1901.     bne    P61_zample
  1902.     bra    P61_nocha
  1903.     endc
  1904.  
  1905.     ifne    P61_sft
  1906. P61_setfinetune
  1907.     moveq    #$f,d0
  1908.     and.b    P61_Info(a5),d0
  1909.     ifeq    opt020
  1910.     add    d0,d0
  1911.     move    P61_mulutab(pc,d0),P61_Fine(a5)
  1912.     else
  1913.     move    P61_mulutab(pc,d0*2),P61_Fine(a5)
  1914.     endc
  1915.     bra    P61_fxdone
  1916.  
  1917. P61_mulutab
  1918.     dc    0,74,148,222,296,370,444,518,592,666,740,814,888,962,1036,1110
  1919.     endc
  1920.  
  1921.     ifne    P61_pl
  1922. P61_patternloop
  1923.     moveq    #$f,d0
  1924.     and.b    P61_Info(a5),d0
  1925.     beq.b    P61_setloop
  1926.  
  1927.     tst.b    P61_plflag-P61_cn(a3)
  1928.     bne.b    P61_noset
  1929.  
  1930.     move    d0,P61_plcount-P61_cn(a3)
  1931.     st.b    P61_plflag-P61_cn(a3)
  1932. P61_noset
  1933.     tst    P61_plcount-P61_cn(a3)
  1934.     bne.b    P61_looppaa
  1935.     clr.b    P61_plflag-P61_cn(a3)
  1936.     bra    P61_fxdone
  1937.     
  1938. P61_looppaa
  1939.     st.b    P61_plflag+1-P61_cn(a3)
  1940.     subq    #1,P61_plcount-P61_cn(a3)
  1941.     bra    P61_fxdone
  1942.  
  1943. P61_setloop
  1944.     tst.b    P61_plflag-P61_cn(a3)
  1945.     bne    P61_fxdone
  1946.     move    P61_rowpos(pc),P61_plrowpos-P61_cn(a3)
  1947.     lea    P61_temp0+P61_TData(pc),a1
  1948.     lea    P61_looppos(pc),a0
  1949.     moveq    #channels-1,d0
  1950. .talt    move.l    (a1)+,(a0)+
  1951.     move.l    (a1)+,(a0)+
  1952.     move.l    (a1),(a0)+
  1953.     subq.l    #8,a1
  1954.     add.l    d6,a1
  1955.     dbf    d0,.talt
  1956.     bra    P61_fxdone
  1957.     endc
  1958.  
  1959.     ifne    P61_fvu
  1960. P61_finevup
  1961.     moveq    #$f,d0
  1962.     and.b    P61_Info(a5),d0
  1963.     add    d0,P61_Volume(a5)
  1964.     moveq    #64,d0
  1965.     cmp    P61_Volume(a5),d0
  1966.     bge    P61_fxdone
  1967.     move    d0,P61_Volume(a5)
  1968.     bra    P61_fxdone
  1969.     endc
  1970.  
  1971.     ifne    P61_fvd
  1972. P61_finevdwn
  1973.     moveq    #$f,d0
  1974.     and.b    P61_Info(a5),d0
  1975.     sub    d0,P61_Volume(a5)
  1976.     bpl    P61_fxdone
  1977.     clr    P61_Volume(a5)
  1978.     bra    P61_fxdone
  1979.     endc
  1980.  
  1981.     ifne    P61_timing
  1982. P61_sete8
  1983.     moveq    #$f,d0
  1984.     and.b    P61_Info(a5),d0
  1985.     move    d0,P61_E8-P61_cn(a3)
  1986.     bra    P61_fxdone
  1987.     endc
  1988.  
  1989.     ifne    P61_rt
  1990. P61_setretrig
  1991.     moveq    #$f,d0
  1992.     and.b    P61_Info(a5),d0
  1993.     move    d0,P61_RetrigCount(a5)
  1994.     bra    P61_fxdone
  1995.     endc
  1996.  
  1997.     ifne    P61_nd
  1998. P61_ndelay
  1999.     moveq    #$7e,d0
  2000.     and.b    (a5),d0
  2001.     beq    P61_skip
  2002.     ifne    P61_vib
  2003.     clr.b    P61_VibPos(a5)
  2004.     endc
  2005.     ifne    P61_tre
  2006.     clr.b    P61_TrePos(a5)
  2007.     endc
  2008.     ifne    P61_ft
  2009.     add    P61_Fine(a5),d0
  2010.     endc
  2011.     move    d0,P61_Note(a5)
  2012.     move    (a2,d0),P61_Period(a5)
  2013.     ifeq    fade
  2014.     move    P61_Volume(a5),8(a4)
  2015.     else
  2016.     move    P61_Volume(a5),P61_Shadow(a5)
  2017.     endc
  2018.     bra    P61_skip
  2019.     endc
  2020.  
  2021.     ifne    P61_pde
  2022. P61_pattdelay
  2023.     moveq    #$f,d0
  2024.     and.b    P61_Info(a5),d0
  2025.     move    d0,P61_pdelay-P61_cn(a3)
  2026.     st    P61_pdflag-P61_cn(a3)
  2027.     bra    P61_fxdone
  2028.     endc
  2029.  
  2030.     ifne    P61_sd
  2031. P61_cspeed
  2032.     moveq    #0,d0
  2033.     move.b    P61_Info(a5),d0
  2034.  
  2035.     ifne    CIA
  2036.     tst    P61_Tempo-P61_cn(a3)
  2037.     beq.b    P61_VBlank
  2038.     cmp.b    #32,d0
  2039.     bhs.b    P61_STempo
  2040.     endc
  2041.  
  2042. P61_VBlank
  2043.     cmp.b    #1,d0
  2044.     beq.b    P61_jkd
  2045.  
  2046.     move.b    d0,P61_speed+1-P61_cn(a3)
  2047.     subq.b    #1,d0
  2048.     move.b    d0,P61_speed2+1-P61_cn(a3)
  2049.     clr    P61_speedis1-P61_cn(a3)
  2050.     bra    P61_fxdone
  2051.  
  2052. P61_jkd    move.b    d0,P61_speed+1-P61_cn(a3)
  2053.     move.b    d0,P61_speed2+1-P61_cn(a3)
  2054.     st    P61_speedis1-P61_cn(a3)
  2055.     bra    P61_fxdone
  2056.  
  2057.  
  2058.     ifne    CIA
  2059. P61_STempo
  2060.     move.l    P61_timer(pc),d1
  2061.     divu    d0,d1
  2062.     move    d1,P61_thi2-P61_cn(a3)
  2063.     sub    #$1f0*2,d1
  2064.     move    d1,P61_thi-P61_cn(a3)
  2065.  
  2066.     ifeq    system
  2067.     move    P61_thi2-P61_cn(a3),d1
  2068.     move.b    d1,$bfd400
  2069.     lsr    #8,d1
  2070.     move.b    d1,$bfd500
  2071.     endc
  2072.  
  2073.     bra    P61_fxdone
  2074.     endc
  2075.     endc
  2076.  
  2077.  
  2078.  
  2079.     ifne    P61_vbvs
  2080. P61_vibochvslide
  2081.     move.b    P61_Info(a5),d0
  2082.     sub.b    d0,P61_Volume+1(a5)
  2083.     bpl.b    P61_test62
  2084.     clr    P61_Volume(a5)
  2085.     ifeq    fade
  2086.     clr    8(a4)
  2087.     else
  2088.     clr    P61_Shadow(a5)
  2089.     endc
  2090.     bra.b    P61_vib2
  2091. P61_test62
  2092.     moveq    #64,d0
  2093.     cmp    P61_Volume(a5),d0
  2094.     bge.b    .ncs2
  2095.     move    d0,P61_Volume(a5)
  2096. .ncs2
  2097.     ifeq    fade
  2098.     move    P61_Volume(a5),8(a4)
  2099.     else
  2100.     move    P61_Volume(a5),P61_Shadow(a5)
  2101.     endc
  2102.     endc
  2103.  
  2104.     ifne    P61_vib
  2105. P61_vib2
  2106.     move    #$f00,d0
  2107.     move    P61_VibCmd(a5),d1
  2108.     and    d1,d0
  2109.     lsr    #3,d0
  2110.  
  2111.     lsr    #2,d1
  2112.     and    #$1f,d1
  2113.     add    d1,d0
  2114.  
  2115.     move    P61_Period(a5),d1
  2116.     moveq    #0,d2
  2117.     move.b    P61_vibtab(pc,d0),d2
  2118.  
  2119.     tst.b    P61_VibPos(a5)
  2120.     bmi.b    .vibneg
  2121.     add    d2,d1
  2122.     bra.b    P61_vib4
  2123.  
  2124. .vibneg    sub    d2,d1
  2125.  
  2126. P61_vib4
  2127.     move    d1,6(a4)
  2128.     move.b    P61_VibCmd(a5),d0
  2129.     lsr.b    #2,d0
  2130.     and    #$3c,d0
  2131.     add.b    d0,P61_VibPos(a5)
  2132.     bra    P61_contfxdone
  2133.     endc
  2134.  
  2135.     ifne    P61_tre
  2136. P61_tremo
  2137.     move    #$f00,d0
  2138.     move    P61_TreCmd(a5),d1
  2139.     and    d1,d0
  2140.     lsr    #3,d0
  2141.     
  2142.     lsr    #2,d1
  2143.     and    #$1f,d1
  2144.     add    d1,d0
  2145.  
  2146.     move    P61_Volume(a5),d1
  2147.     moveq    #0,d2
  2148.     move.b    P61_vibtab(pc,d0),d2
  2149.  
  2150.     tst.b    P61_TrePos(a5)
  2151.     bmi.b    .treneg
  2152.     add    d2,d1
  2153.     cmp    #64,d1
  2154.     ble.b    P61_tre4
  2155.     moveq    #64,d1
  2156.     bra.b    P61_tre4
  2157.  
  2158. .treneg    sub    d2,d1
  2159.     bpl.b    P61_tre4
  2160.     moveq    #0,d1
  2161. P61_tre4
  2162.     ifeq    fade
  2163.     move    d1,8(a4)
  2164.     else
  2165.     move    d1,P61_Shadow(a5)
  2166.     endc
  2167.  
  2168.     move.b    P61_TreCmd(a5),d0
  2169.     lsr.b    #2,d0
  2170.     and    #$3c,d0
  2171.     add.b    d0,P61_TrePos(a5)
  2172.     bra    P61_contfxdone
  2173.     endc
  2174.  
  2175.     ifne    P61_vib!P61_tre
  2176. P61_vibtab    incbin    Hilda:Music/Player6.1a/Source/vibtab
  2177.     endc
  2178.  
  2179.     ifne    P61_il
  2180. P61_funk
  2181.     moveq    #$f,d0
  2182.     and.b    P61_Info(a5),d0
  2183.     move.b    d0,P61_Funkspd(a5)
  2184.     bra    P61_fxdone
  2185.  
  2186. P61_funk2
  2187.     moveq    #0,d0
  2188.     move.b    P61_Funkspd(a5),d0
  2189.     beq.b    P61_funkend
  2190.     move.b    P61_FunkTable(pc,d0),d0
  2191.     add.b    d0,P61_Funkoff(a5)
  2192.     bpl.b    P61_funkend
  2193.     clr.b    P61_Funkoff(a5)
  2194.  
  2195.     move.l    P61_Sample(a5),a1
  2196.     move.l    P61_RepeatOffset(a1),d1
  2197.     move    P61_RepeatLength(a1),d0
  2198.     add.l    d0,d0
  2199.     add.l    d1,d0
  2200.     move.l    P61_Wave(a5),a0
  2201.     addq.l    #1,a0
  2202.     cmp.l    d0,a0
  2203.     blo.b    P61_funkok
  2204.     move.l    d1,a0
  2205. P61_funkok
  2206.     move.l    a0,P61_Wave(a5)
  2207.     not.b    (a0)
  2208. P61_funkend
  2209.     rts
  2210.  
  2211. P61_FunkTable dc.b 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128
  2212.     endc
  2213.  
  2214. P61_jtab
  2215.     dc.w    P61_fxdone-*
  2216.     dc.w    P61_fxdone-*
  2217.     dc.w    P61_fxdone-*
  2218.  
  2219.     ifne    P61_tp
  2220.     dc.w    P61_settoneport-*
  2221.     else
  2222.     dc.w    P61_fxdone-*
  2223.     endc
  2224.  
  2225.     ifne    P61_vib
  2226.     dc.w    P61_vibrato-*
  2227.     else
  2228.     dc.w    P61_fxdone-*
  2229.     endc
  2230.  
  2231.     ifne    P61_tpvs
  2232.     dc.w    P61_toponochange-*
  2233.     else
  2234.     dc.w    P61_fxdone-*
  2235.     endc
  2236.  
  2237.     dc.w    P61_fxdone-*
  2238.  
  2239.     ifne    P61_tre
  2240.     dc.w    P61_settremo-*
  2241.     else
  2242.     dc.w    P61_fxdone-*
  2243.     endc
  2244.  
  2245.     dc.w    P61_fxdone-*
  2246.  
  2247.     ifne    P61_sof
  2248.     dc.w    P61_sampleoffse-*
  2249.     else
  2250.     dc.w    P61_fxdone-*
  2251.     endc
  2252.     dc.w    P61_fxdone-*
  2253.  
  2254.     ifne    P61_pj
  2255.     dc.w    P61_posjmp-*
  2256.     else
  2257.     dc.w    P61_fxdone-*
  2258.     endc
  2259.  
  2260.     ifne    P61_vl
  2261.     dc.w    P61_volum-*
  2262.     else
  2263.     dc.w    P61_fxdone-*
  2264.     endc
  2265.  
  2266.     ifne    P61_pb
  2267.     dc.w    P61_pattbreak-*
  2268.     else
  2269.     dc.w    P61_fxdone-*
  2270.     endc
  2271.  
  2272.     ifne    P61_ec
  2273.     dc.w    P61_ecommands-*
  2274.     else
  2275.     dc.w    P61_fxdone-*
  2276.     endc
  2277.     
  2278.     ifne    P61_sd
  2279.     dc.w    P61_cspeed-*
  2280.     else
  2281.     dc.w    P61_fxdone-*
  2282.     endc
  2283.  
  2284.  
  2285. P61_dmason
  2286.     ifeq    system
  2287.     tst.b    $bfdd00
  2288.     move    #$2000,$dff09c
  2289.     move.b    #$19,$bfdf00
  2290.     move.l    a0,-(sp)
  2291.     move.l    P61_vektori(pc),a0
  2292.     move.l    P61_intaddr(pc),(a0)
  2293.     move.l    (sp)+,a0
  2294.     move    P61_dma(pc),$dff096
  2295.     nop
  2296.     rte
  2297.  
  2298.     else
  2299.  
  2300.     move    P61_dma(pc),$96(a6)
  2301.     lea    P61_server(pc),a3
  2302.     addq    #1,(a3)
  2303.     move.l    P61_craddr(pc),a0
  2304.     move.b    #$19,(a0)
  2305.     bra    P61_ohi
  2306.     endc
  2307.  
  2308.  
  2309. P61_setrepeat
  2310.     ifeq    system
  2311.     tst.b    $bfdd00
  2312.     movem.l    a0/a1,-(sp)
  2313.     lea    $dff0a0,a1
  2314.     move    #$2000,-4(a1)
  2315.     else
  2316.     lea    $a0(a6),a1
  2317.     endc
  2318.  
  2319.     move.l    P61_Sample+P61_temp0(pc),a0
  2320.     addq.l    #6,a0
  2321.     move.l    (a0)+,(a1)+
  2322.     move    (a0),(a1)
  2323.  
  2324.     ifgt    channels-1
  2325.     move.l    P61_Sample+P61_temp1(pc),a0
  2326.     addq.l    #6,a0
  2327.     move.l    (a0)+,12(a1)
  2328.     move    (a0),16(a1)
  2329.     endc
  2330.     
  2331.     ifgt    channels-2
  2332.     move.l    P61_Sample+P61_temp2(pc),a0
  2333.     addq.l    #6,a0
  2334.     move.l    (a0)+,28(a1)
  2335.     move    (a0),32(a1)
  2336.     endc
  2337.  
  2338.     ifgt    channels-3
  2339.     move.l    P61_Sample+P61_temp3(pc),a0
  2340.     addq.l    #6,a0
  2341.     move.l    (a0)+,44(a1)
  2342.     move    (a0),48(a1)
  2343.     endc
  2344.  
  2345.     ifne    system
  2346.     ifne    CIA
  2347.     lea    P61_server(pc),a3
  2348.     clr    (a3)
  2349.     move.l    P61_craddr+4(pc),a0
  2350.     move.b    P61_tlo(pc),(a0)
  2351.     move.b    P61_thi(pc),$100(a0)
  2352.     endc
  2353.     bra    P61_ohi
  2354.     endc
  2355.  
  2356.     ifeq    system
  2357.     ifne    CIA
  2358.     move.l    P61_vektori(pc),a0
  2359.     move.l    P61_tintti(pc),(a0)
  2360.     endc
  2361.     movem.l    (sp)+,a0/a1
  2362.     nop
  2363.     rte
  2364.     endc
  2365.  
  2366. P61_temp0    dcb.b    Channel_Block_SIZE-2
  2367.         dc    1
  2368.  
  2369. P61_temp1    dcb.b    Channel_Block_SIZE-2
  2370.         dc    2
  2371.  
  2372. P61_temp2    dcb.b    Channel_Block_SIZE-2
  2373.         dc    4
  2374.  
  2375. P61_temp3    dcb.b    Channel_Block_SIZE-2
  2376.         dc    8
  2377.  
  2378. P61_cn        dc    0
  2379. P61_dma        dc    $8200
  2380. P61_rowpos    dc    0
  2381. P61_slen    dc    0
  2382. P61_speed    dc    0
  2383. P61_speed2    dc    0
  2384. P61_speedis1    dc    0
  2385. P61_spos    dc.l    0
  2386.  
  2387.     ifeq    system
  2388. P61_vektori    dc.l    0
  2389. P61_oldlev6    dc.l    0
  2390.     endc
  2391.  
  2392. P61_ofilter    dc    0
  2393. P61_Timers    dc.l    0
  2394.  
  2395.     ifne    CIA
  2396. P61_tintti    dc.l    0
  2397. P61_thi        dc.b    0
  2398. P61_tlo        dc.b    0
  2399. P61_thi2    dc.b    0
  2400. P61_tlo2    dc.b    0
  2401. P61_timer    dc.l    0
  2402.     endc
  2403.  
  2404.     ifne    P61_pl
  2405. P61_plcount    dc    0
  2406. P61_plflag    dc    0
  2407. P61_plreset    dc    0
  2408. P61_plrowpos    dc    0
  2409. P61_looppos    dcb.b    12*channels
  2410.     endc
  2411.  
  2412.     ifne    P61_pde
  2413. P61_pdelay    dc    0
  2414. P61_pdflag    dc    0
  2415.     endc
  2416.  
  2417. P61_Samples    dcb.b    16*31
  2418. P61_positionbase dc.l    0
  2419. P61_possibase    dc.l    0
  2420. P61_patternbase    dc.l    0
  2421. P61_intaddr    dc.l    0
  2422.  
  2423.     ifne    system
  2424. P61_server    dc    0
  2425. P61_miscbase    dc.l    0
  2426. P61_audioopen    dc.b    0
  2427. P61_sigbit    dc.b    -1
  2428. P61_ciares    dc.l    0
  2429. P61_craddr    dc.l    0,0,0
  2430. P61_dat        dc    $f00
  2431. P61_timerinterrupt dc    0,0,0,0,127
  2432. P61_timerdata    dc.l    0,0,0
  2433.  
  2434. P61_allocport    dc.l    0,0
  2435.         dc.b    4,0
  2436.         dc.l    0
  2437.         dc.b    0,0
  2438.         dc.l    0
  2439. P61_reqlist    dc.l    0,0,0
  2440.         dc.b    5,0
  2441. P61_allocreq    dc.l    0,0
  2442.         dc    127
  2443.         dc.l    0
  2444. P61_portti    dc.l    0
  2445.         dc    68
  2446.         dc.l    0,0,0
  2447.         dc    0
  2448. P61_reqdata    dc.l    0
  2449.         dc.l    1,0,0,0,0,0,0
  2450.         dc    0
  2451. P61_audiodev    dc.b    'audio.device',0
  2452.  
  2453. P61_cianame    dc.b    'ciab.resource',0
  2454. P61_timeropen    dc.b    0
  2455. P61_timerint    dc.b    'P61_TimerInterrupt',0,0
  2456.     endc
  2457. P61_etu
  2458.  
  2459.